package com.edais.util;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class Env {
	private static final Log logger = LogFactory.getLog(Env.class);

	private static Properties props = new Properties();
	static {
		try {
			props.load(Thread.currentThread().getContextClassLoader()
					.getResourceAsStream("config.properties"));
		} catch (FileNotFoundException e) {
			logger.error("读取配置文件application.properties异常", e);
		} catch (IOException e) {
			logger.error("读取配置文件application.properties异常", e);
		}
	}

	private Env() {
	}

	public static String getValue(String key) {
		return props.getProperty(key);
	}

	public static void updateProperties(String key, String value) {
		props.setProperty(key, value);
	}
}